﻿namespace Digitalmes.Application;

/// <summary>
/// Tree 类型 DTO 对象基类
/// </summary> 
public class TreeDto : Dto
{
    public string? Label { get; set; }

    public string? Value { get; set; }

    /// <summary>
    /// 是否是叶节点
    /// </summary>
    public bool IsLeaf { get; set; }

    /// <summary>
    /// 父节点 Id，0 表示没有。
    /// </summary>
    public long ParentId { get; set; }

    /// <summary>
    /// 父节点值，null 表示没有。
    /// </summary>
    public string? ParentValue { get; set; }

    public List<TreeDto>? Children { get; set; }
}

/// <summary>
/// Tree 类型 DTO 对象基类
/// </summary> 
public sealed class TreeDto<T> : TreeDto
{
    public T? Data { get; set; }

    public new List<TreeDto<T>>? Children { get; set; }
}
